package com.testdemo.web.shapecalc.impl;

public class SquareQuestionImpl extends ShapeQuestionImpl {
	int Length;
	public SquareQuestionImpl()
	{
		Length = Math.abs((int)(Math.random() * 10 + 1));
		CalcArea();
		CalcPerimeter();		
	}
	
	public SquareQuestionImpl(int l)
	{
		Length = l;
		CalcArea();
		CalcPerimeter();		
	}
	
	public void CalcArea(){
		Area = Length * Length;		
	}
	public void CalcPerimeter()
	{
		this.Perimeter = 4 * Length;
	}

	@Override
	public String getQusitionString() {
		// TODO Auto-generated method stub
		String temp;
		temp = "题目：一个为正方形边长为 " + Integer.toString(Length) + ", 请计算该正方形的面积和周长。";
		return temp;
	}
}
